//
//  UserAccount.swift
//  艾小夕の微小博
//
//  Created by 艾小新 on 15/10/17.
//  Copyright © 2015年 艾小新. All rights reserved.
//

import UIKit

class UserAccount: NSObject {
    
    /// 用于调用access_token，接口获取授权后的access token
    var access_token: String?
    /// access_token的生命周期，单位是秒数 - 准确的数据类型是`数值`
    var expires_in: NSTimeInterval = 0 {
        didSet {
            expiresDate = NSDate(timeIntervalSinceNow: expires_in)
        }
    }
    /// 过期日期
    var expiresDate: NSDate?
    /// 当前授权用户的UID
    var uid: String?
    
    
    /// 字典转模型
    init(dict: [String : AnyObject]) {
        
        super.init()
        
        setValuesForKeysWithDictionary(dict)
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    /// 对象描述信息
    override var description: String {
        let properties = ["access_token", "expires_in", "uid", "expiresDate"]
        
        return "\(dictionaryWithValuesForKeys(properties))"
    }

}
